Building sample FMs in Emulation Mode on Windows
This chapter provides instructions on how to compile the sample FM projects in the Windows environment.
The process consists of the following steps:
-
Copy the samples and emulation source folders.
-
Set the environment variables.
-
Compile the binaries.
Copy the samples and emulation source folders
Microsoft recommends against creating and editing files in the Program Files folder. To avoid running into issues with the UAC, copy the samples folder and the emul folder to a separate folder. These will be referred to as the %SRC% and %EMUL% folders respectively.
Set the environment variables
-
Open a Visual Studio Command Prompt to load the Visual studio compiler.
-
Run the fmsdkvars.bat file found in the FM-SDK installation folder to set the %FMDIR% and %CPROVDIR% environment variables.
%FMDIR%\bin\fmsdkvars.bat
-
Set the %OUTDIR% environment variable. This is the folder where the emulation libraries will be created.
set OUTDIR=c:\fmdemo
-
Set the %FM_BIN% environment variable. This is the name of the FM emulation library.
set FM_BIN=fm-restrict
Compile the binaries
-
Navigate to the sample folder's FM directory (for example, %SRC%\restrict\fm) and run nmake -f nt.mak
cd %SRC%\restrict\fm nmake -f nt.mak
-
Navigate to the sample folder's host directory (for example, %SRC%\restrict\host) and run nmake -f nt.mak
cd %SRC%\restrict\host nmake -f nt.mak
-
Navigate to the %EMUL% folder and run nmake -f nt.mak
cd %EMUL% nmake -f nt.mak
-
Navigate to the %OUTDIR% folder:
cd %OUTDIR%
-
In there, you should have the following files:
-
%FM_BIN%.dll
-
%CLIENT_BIN%.exe
-
cryptoki.dll
-
ethsm.dll
-
-
Run the executable to test the FM.